﻿<%@ Page language="c#" Codebehind="Catalog.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.BBS.Catalog" %>
<%@ Import namespace="System"%>
<%@ Import namespace="System.Data"  %>
<%@ Import namespace="System.Data.SqlClient"  %>
<%@ Import namespace="UDS.Components"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-cn" />
<meta name="author" content="Herry" />
<meta name="Copyright" content="Copyright (c) 2009 himm.cn" />
<title>BBS</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link rel="stylesheet" type="text/css" href="/css/other.css" media="screen" />
<style type="text/css">
table th{ background:#ccccff;}
table th,table td {border:1px solid #93BEE2; padding:3px;}
table th{ background:url(/images/public/th_bg.gif) #000 repeat-x left bottom;cursor:help}
</style>
<script language="C#" runat="server">
		private string GetImageAlt(string str)
		{
			if(Int32.Parse(str)>0 )
				return("有贴子"); 
			else
				return("没有贴子");
		}
		private string GetImagePath(string str)
		{
			if(Int32.Parse(str)>0 )
				return("../../../images/forum_isnews.gif");
			else
				return("../../../images/forum_nonews.gif");
		}
		private string GetTitle(string str)
		{
			int limitwordnumber = 50;
			if(str.Length>limitwordnumber)
				return(str.Substring(0,limitwordnumber-1));
			else
				return(str);
		}
		private bool AdminBoard(int board,string username)
		{
			BBSClass bbs = new BBSClass();
			return(bbs.IsBoardMaster(board,username));
		}
		private string GetBoardMasterRealName(int userid)
		{
			string result = "";
			UDS.Components.Staff staff = new UDS.Components.Staff();
			SqlDataReader dr = staff.GetStaffInfo(userid);
			while(dr.Read())
			{
				result = dr["RealName"].ToString();
			}
			return(result);
		}
		</script>
</head>
<body>
<div class="m">
  <p class="path"><span class="right"><a href='<%="search/index.aspx?classid="+classid%>'>公司论坛搜索</a></span><a href="/SubModule/UnitiveDocument/">我的桌面</a> >> 公司论坛</p>
  <div class="con">
    <form id="Catalog" method="post" runat="server">

      <table id="AutoNumber1" style=" border:1px solid #93BEE2;"cellSpacing="0" cellPadding="0" width="100%">
        <tr>
          <th>论坛</th>
          <th>帖子</td>
          <th>回复</th>
          <th>最新帖子</th>
          <th>版主</th>
        </tr>
        <tr>
          <td><A id="A1" runat=server >添加分类</A></td>
        </tr>
        <asp:repeater id="rpt_catalog" Runat="server">
          <ItemTemplate>
            <tr>
              <td>
                <asp:label id="LCatalog" runat="server" Width="100%" text='<%# DataBinder.Eval(Container.DataItem,"catalog_name") %>'> </asp:label>
                </td>
            </tr>
            <tr>
              <td>
                <asp:label id="LCatalog_Description" runat="server" Width="100%"  text='<%# DataBinder.Eval(Container.DataItem,"catalog_description") %>'> </asp:label>
               </td>
            </tr>
            <tr>
              <td><asp:Panel ID="adminop" Runat=server Visible='<%# Admin%>'>
                  <A  href="ManageBoard.aspx?Action=AddBoard&CatalogID=<%# DataBinder.Eval(Container.DataItem,"catalog_id")%>&classID=<%=classid%>">添加板块</A>|
                  <asp:LinkButton ID="btndelcatalog" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"catalog_id")%>' OnClick="btndelcatalog_Click" Runat=server>删除分类</asp:LinkButton>
                  |<A  href="ManageCatalog.aspx?Action=ModifyCatalog&CatalogID=<%# DataBinder.Eval(Container.DataItem,"catalog_id")%>&classID=<%=classid%>"> 编辑分类</A>|
                  </asp:Panel></td>
            </tr>
            <asp:Repeater ID="rpt_board" OnItemDataBound="rpt_board_ItemDataBound" DataSource='<%# ((DataRowView)Container.DataItem).Row.GetChildRows("catolog_board") %>' Runat="server">
              <ItemTemplate>
                <tr>
                  <td>&nbsp; <img  runat="server" alt='<%# GetImageAlt(DataBinder.Eval(Container.DataItem,"[\"formitems\"]").ToString())%>' src='<%# GetImagePath(DataBinder.Eval(Container.DataItem,"[\"formitems\"]").ToString())%>' />
                  <td>
                    <P><a href="ListView.aspx?BoardID=<%# DataBinder.Eval(Container.DataItem,"[\"board_id\"]")%>&ClassID=<%# Request["ClassID"]%>"><%# DataBinder.Eval(Container.DataItem,"[\"board_name\"]")%></a></P>
                    <P>
                      <asp:Label id="LBoardDescription" runat="server"> <%# DataBinder.Eval(Container.DataItem,"[\"board_description\"]")%> </asp:Label>
                    </P>
                    </td>
                  <td>
                    <asp:label id="LForumTimes" runat="server"> <%# DataBinder.Eval(Container.DataItem,"[\"formitems\"]")%> </asp:label>
                   </td>
                  <td><asp:label id="LReplays" runat="server"> <%# DataBinder.Eval(Container.DataItem,"[\"replays\"]")%> </asp:label></td>
                  <td> <a href='<%# "Display.aspx?ItemID="+DataBinder.Eval(Container.DataItem,"[\"item_id\"]").ToString()%>' target=_blank>
                    <asp:label id="LForumItem" runat="server"> <%# GetTitle(DataBinder.Eval(Container.DataItem,"[\"title\"]").ToString())%> </asp:label>
                    </a> <br>
                    <asp:Label id="LSender" runat="server"> <%# DataBinder.Eval(Container.DataItem,"[\"sender\"]")%> </asp:Label>
                    <br>
                    <asp:Label id="LSendTime" runat="server"> <%# DataBinder.Eval(Container.DataItem,"[\"send_time\"]")%> </asp:Label>
                    </td>
                  <td><asp:Repeater id="rpt_boardmaster" DataSource='<%# ((DataRow)Container.DataItem).GetChildRows("board_boardmaster")%>' Runat="server">
                      <ItemTemplate> <a href="../Mail/Compose.aspx?Action=3&ClassID=0&Username=<%# DataBinder.Eval(Container.DataItem,"[\"staff_Name\"]")%>&Name=<%# GetBoardMasterRealName(Int32.Parse(DataBinder.Eval(Container.DataItem,"[\"staff_id\"]").ToString()))%>"><%# DataBinder.Eval(Container.DataItem,"[\"RealName\"]")%></a><br>
                      </ItemTemplate>
                    </asp:Repeater>
                  </td>
                </tr>
                <tr>
                  <td><asp:Panel ID="Adminop1" Runat=server Visible='<%# AdminBoard(Int32.Parse(DataBinder.Eval(Container.DataItem,"[\"board_id\"]").ToString()),Username) || Admin %>'>
                      <A href="ManageBoardMaster.aspx?BoardID=<%# DataBinder.Eval(Container.DataItem,"[\"board_id\"]")%>&classID=<%=classid%>" >设定斑竹</A>|
                      <asp:LinkButton ID="lbtnDelBoard" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"[\"board_id\"]")%>' OnClick="DeleteBoard"  Runat=server>删除板块</asp:LinkButton>
                      |<A href="ManageBoard.aspx?Action=ModifyBoard&BoardID=<%# DataBinder.Eval(Container.DataItem,"[\"board_id\"]")%>&classID=<%=classid%>"> 编辑板块</A>|
                      <asp:HyperLink id="SetBoardMember" NavigateUrl='<%# "ManageBoardMember.aspx?BoardID="+DataBinder.Eval(Container.DataItem,"[\"board_id\"]")+"&classid="+classid%>' Visible='<%# !Convert.ToBoolean(DataBinder.Eval(Container.DataItem,"[\"board_type\"]"))%>' runat=server>编辑成员</asp:HyperLink>
                      </asp:Panel></td>
                </tr>
              </ItemTemplate>
            </asp:Repeater>
          </ItemTemplate>
        </asp:repeater>
      </table>
      <div id="AutoNumber2"></div>
    </form>
  </div>
</div>
</body>
</html>
